package com.year_23.may;

/**
 * @author: jsh
 * @create: 2023/5/5 22:09
 * @Description:        2432. 处理用时最长的那个任务的员工
 *                      https://leetcode.cn/problems/the-employee-that-worked-on-the-longest-task/
 * @FileName: Day05
 * @History:
 * @自定义内容：
 */
public class Day05 {

    public int hardestWorker(int n, int[][] logs) {
        int length = logs.length;
        int max = logs[0][1];
        int res = logs[0][0];
        for (int i = 1; i < length; i++) {
            if (logs[i][1]-logs[i-1][i] > max || logs[i][i]-logs[i-1][i] == max && logs[i][0] < res){
                max = logs[i][1]-logs[i-1][i];
                res = logs[i][0];
            }
        }
        return res;
    }

}
